<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.w3.org/1999/xhtml">
<head>
    <title>Title</title>
    <div th:replace="common/links::header"></div>
    <div th:replace="common/script::js_footer"></div>
    <script th:src="@{/js/common/verify.js}"></script>
</head>
<body class="form-body">
<form class="layui-form ">
    <input type="hidden" name="id" th:value="${dict.id}">
    <div class="layui-form-item layui-col-md6 layui-col-md-offset2">
        <label class="layui-form-label">名称</label>
        <div class="layui-input-inline form-length350">
            <input type="text" name="name" th:value="${dict.name}" lay-verify="required"
                   placeholder="请输入名称" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">*6-12个字符</div>
    </div>
    <div class="layui-form-item layui-col-md4 layui-col-md-offset2">
        <label class="layui-form-label">类别</label>
        <div class="layui-input-inline">
            <input type="text" name="typeCode" th:value="${dict.typeCode}" lay-verify="required" lay-verType="tips"
                   placeholder="请输入类别" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">*类别</div>
    </div>
    <div class="layui-form-item">
        <div class="layui-col-md4 layui-col-md-offset2">
            <label class="layui-form-label">是否可编辑</label>
            <div class="layui-input-inline">
                <input type="radio" name="isEdit" value="1" title="是"  th:checked="${dict.isEdit == '1'}">
                <input type="radio" name="isEdit" value="0" title="否"  th:checked="${dict.isEdit == '0'}">
            </div>
        </div>
    </div>
    <div class="layui-form-item layui-col-md4 layui-col-md-offset2">
        <label class="layui-form-label">排序号</label>
        <div class="layui-input-inline">
            <input type="number" name="sortNo" th:value="${dict.sortNo}" lay-verify="required" placeholder="请输入排序号"
                   autocomplete="off" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">*排序号</div>
    </div>
    <div class="layui-form-item layui-col-md-offset5">
        <div class="layui-input-block">
            <button class="layui-btn" shiro:hasPermission="sys:dict:basic:op" lay-submit="" lay-filter="add">立即提交</button>
            <button id="closeBtn" type="button" class="layui-btn layui-btn-primary">取消</button>
        </div>
    </div>
</form>
<script type="text/javascript" th:inline="javascript">
    layui.use('form', function () {
        var form = layui.form, $ = layui.jquery;
        form.render();
        //监听提交
        form.on('submit(add)', function (data) {
            Common.ajaxFormSubmit('/pt/dict/save-or-update', data.field, function (data) {
                console.log(data);
                layer.msg(data.msg,{icon:6},function () {
                    Common.closeFrame();
                });
            });
            return false;
        });

        $("#closeBtn").on('click',function () {
            Common.closeFrame();
        });
    });
</script>
</body>
</html>